package tech.aistar.service;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import tech.aistar.entity.massage.Massage;
import tech.aistar.util.IdWorker;

import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class MassageTest {
    @Autowired
    private IMassageService massageService;
    @Autowired
    private IdWorker idWorker;


    @Test
    public void testadd(){

        Massage massage1 = new Massage(idWorker.nextId(),3,"娜美",0,1,"是路飞呀","二,去接山治啊",null,1,null,null,null);
        Massage massage2 = new Massage(idWorker.nextId(),2,"索大",0,1,"是路飞呀","我也去",null,1,null,null,null);

        massageService.addPostMassage(massage1);
        massageService.addPostMassage(massage2);

        Massage massage3 = new Massage(idWorker.nextId(),4,"山治",2,1,"是路飞呀","点赞帖子",null,1,null,null,null);
        Massage massage4 = new Massage(idWorker.nextId(),2,"索大",2,1,"是路飞呀","点赞帖子",null,1,null,null,null);

        Massage massage5 = new Massage(idWorker.nextId(),4,"山治",1,1,"是路飞呀","回复评论了啦啦啦啦",2,null,null,null,null);
        Massage massage6 = new Massage(idWorker.nextId(),5,"乔巴",1,1,"是路飞呀","回复评论了2222",1,null,null,null,null);

        massageService.addPostZan(massage3);
        massageService.addPostZan(massage4);

        massageService.addComMassage(massage5);
        massageService.addComMassage(massage6);

        Massage massage7 = new Massage(idWorker.nextId(),2,"索大",3,1,"是路飞呀","点赞22",2,null,null,null,null);
        Massage massage8 = new Massage(idWorker.nextId(),3,"娜美",3,2,"索大","点赞11",1,null,null,null,null);
        massageService.addComZan(massage7);
        massageService.addComZan(massage8);

    }

    @Test
    public void test02(){
        List<Massage>mass = massageService.findUidAndPost(1);
        System.out.println(mass.size());
        mass.forEach(System.out::println);
    }
}
